package com.baizhi.cmfz.appcontroller;

import com.baizhi.cmfz.entity.Album;
import com.baizhi.cmfz.service.AlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("album")
public class AlbumController {
    @Autowired
    private AlbumService albumService;
    //查询最新的六张专辑的信息
    @GetMapping("selectNewAlbum/{count}")
    public List<Album> selectNewAlbum(@PathVariable("count") int count) {
        List<Album> albumList = albumService.selectNewAlbum(count);
        return albumList;
    }
    //展示所有专辑
    @GetMapping("selectAllAlbum")
    public List<Album> selectAllAlbum() {
        return albumService.selectAllAlbum();
    }
    //展示一个专辑的详情
    @GetMapping("selectOneAlbum/{albumId}")
    public Album selectOneAlbum(@PathVariable("albumId") int albumId) {
        return albumService.selectOneAlbum(albumId);
    }
}
